package com.example.proxy.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class NoInstanceHandler implements InvocationHandler {
    Class target = null;

    public NoInstanceHandler(Class target) {
        super();
        this.target = target;
    }


    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        return "6666"+proxy.getClass().getName()+method.getName();
    }

    public <T> T getInstance() {
        return (T) Proxy.newProxyInstance(target.getClassLoader(), target.getInterfaces(), this);
    }
}
